// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import VueRouter from 'vue-router'
import VueResource from 'vue-resource'

import './common/stylus/index.styl'
import App from './App'
import store from './store'
import { routes } from './router'

Vue.config.productionTip = false

// 3. 创建 router 实例，然后传 `routes` 配置
// 你还可以传别的配置参数, 不过先这么简单着吧。
// function getAbsolutePath() {
//   let path = location.pathname
//   return path.substring(0, path.lastIndexOf('/') + 1)
// }

const router = new VueRouter({
  mode: 'history',
  routes,
  base: process.env.NODE_ENV === 'development' ? '/' : '/wmapp/', // 原始未配置
  linkActiveClass: 'active',
})

Vue.use(VueRouter)
Vue.use(VueResource)

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>',
})
